<@master template="master/master-loan"  title="申请借款-${title}客户">
	  <div class="action-dialog-model-fixed-body">  
		   <form  name="module" id="module" action="<@url value='/rloanstart/saveOrupdateCustomerBasicInfo'/>" method ='post'   class="action-ajax-form action-ajax-form-valid action-ajax-form-confirm" action-ajax-form-confirm-message="确认提交">
		    <input type="hidden" name="customerId" value="${vo.customerId}"/>
		   	 <input type="hidden" name="mateId" value="${vo.spouse.customerId}"/>	
		   	 <input type="hidden" name="idNumber" id="idNumber"value="${idCard}" />	
		   	 <input type="hidden" name="idType" id="idType"value="IDC" />
		   	 <input type="hidden" name="mate_idType" id="mate_idType"value="IDC" />
		   	 <input type="hidden" name="saveType" id="saveType" value="" />		
		     <div class="detailsBox">
						<@include file="loanstart/editLoaner"/>
					   
			         	 <@include file="loanstart/editMate"/>
		                <div class="detaiTab">
			    			<div class="clearfix" align="left"> 
			    			 <table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tbody>
								<tr>
									<td width="15%" align="right" class="bg"> 贷款类型：</td>
									<td colspan="3" ><@select dataSouceType="O2O_LOAN_TYPE_BANK" value="" name="loanType" id="loanType"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</tr>
								<tr>
								<td colspan="3" width="45%" ></td>
								<td>
				              <input type="button" onclick="apply();" class="btn_auto_30 btn_blue mtb20" value="确认" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<!-- 						  <input type="button" name="BP"  onclick="apply('BP');" class="btn_auto_30 btn_blue mtb20" value="申请品牌贷"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
							  <a href="/loanstart/index?idCard=${idCard}"   class="btn_auto_30 btn_blue mtb20"> 返回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							</td></tr></tbody></table>
							</div>
						</div>
			</div>	
		  </form>
		  <@js>
		   //加载配偶信息
		$(function(){
				//1.配偶情况
				var maritalStatus = $("select[id='maritalStatus']").val();
				var mateId=$("input[name='mateId']").val();
				if(maritalStatus == 2 || maritalStatus ==''){
						$('#detail_marital').show();
						$("input[name='mate_customerFamilyName']").attr('data-action-valid-rule','required;minlength:1;maxlength:8;reg:^.{1,8}$');
					 	$("input[name='mate_customerGivenName']").attr('data-action-valid-rule','required;minlength:1;maxlength:8;reg:^.{1,8}$');
					 	$("input[name='mate_surnamePinyin']").attr('data-action-valid-rule','required;'); 
					 	$("input[name='mate_namePinyin']").attr('data-action-valid-rule','required;');   
					  	$("input[id='mate_idNumber']").attr("data-action-valid-rule","required;minlength:15;maxlength:18;reg:(^[0-9]{15}$)|(^[0-9]{18}$)|(^[0-9]{17}([0-9]|X|x)$)");
						$("input[name='mate_mobileNumber']").attr('data-action-valid-rule','required;number;maxlength:20');
					    $("input[name='mate_licenseExpirationDate']").attr('data-action-valid-rule','required;');
					  
				}else{
				
						$('#detail_marital').hide();
						$("input[name='mate_customerFamilyName']").removeAttr('data-action-valid-rule');
					 	$("input[name='mate_customerGivenName']").removeAttr('data-action-valid-rule'); 
					 	$("input[name='mate_surnamePinyin']").removeAttr('data-action-valid-rule'); 
					 	$("input[name='mate_namePinyin']").removeAttr('data-action-valid-rule'); 
					 	$("input[name='mate_idNumber']").removeAttr('data-action-valid-rule');
					 	$("input[name='mate_mobileNumber']").removeAttr('data-action-valid-rule');
					 	$("input[name='mate_licenseExpirationDate']").removeAttr('data-action-valid-rule');
				}

		});
	
		//配偶信息的联动
		$("#maritalStatus").change(function(){
			var maritalStatus = $(this).val();
			if(maritalStatus == 2 || maritalStatus ==''){
					$('#detail_marital').show();
					$("input[name='mate_customerFamilyName']").attr('data-action-valid-rule','required;minlength:1;maxlength:8;reg:^.{1,8}$');
				 	$("input[name='mate_customerGivenName']").attr('data-action-valid-rule','required;minlength:1;maxlength:8;reg:^.{1,8}$'); 
				 	$("input[name='mate_surnamePinyin']").attr('data-action-valid-rule','required;');
				 	$("input[name='mate_namePinyin']").attr('data-action-valid-rule','required;');
				  	$("input[id='mate_idNumber']").attr("data-action-valid-rule","required;minlength:15;maxlength:18;reg:(^[0-9]{15}$)|(^[0-9]{18}$)|(^[0-9]{17}([0-9]|X|x)$)");				   
					$("input[name='mate_mobileNumber']").attr('data-action-valid-rule','required;number;maxlength:20');
				    $("input[name='mate_licenseExpirationDate']").attr('data-action-valid-rule','required;');
				 
			}else{
					$('#detail_marital').hide();
					$("input[name='mate_customerFamilyName']").removeAttr('data-action-valid-rule');
					$("input[name='mate_customerGivenName']").removeAttr('data-action-valid-rule'); 
					$("input[name='mate_surnamePinyin']").removeAttr('data-action-valid-rule');
					$("input[name='mate_namePinyin']").removeAttr('data-action-valid-rule');
					$("input[name='mate_idNumber']").removeAttr('data-action-valid-rule');
					$("input[name='mate_mobileNumber']").removeAttr('data-action-valid-rule');
					$("input[name='mate_licenseExpirationDate']").removeAttr('data-action-valid-rule');
					
			}
		});
		
		
		   function apply(){
		   var type = $("#loanType").val();
		   if(type==""){
		   	$.actionDialog({message: "请选择贷款类型"});
		   	return;
		   }
            $("#saveType").val(type);
            $("#module").submit();
           
           }
		  </@js>
	  </div>
</@master>